<ul class="subNavig">
    <li><a href="{$data.root}?input=list_of_clients">Clients</a></li>
    <li><a href="{$data.root}?input=list_of_users">Users</a></li>
    <li><a href="{$data.root}?input=list_of_tariffs">Tariffs</a></li>
</ul>
{include $data.pathToError}
<script type="text/javascript">
    {literal}
        
    $(document).ready(function() {
        $(".float").change(function() {
            makeFloat(".float");
        });
        $("#associatedClients").multiselect(); 
    });
    {/literal}
</script>
<h2 class="pageTitle">Add user</h2>
<form class="adding" action="{$data.root}?input=add_user" method="post" onsubmit="return checkAdd_user(
                                                                    $('#name').val(),
                                                                    $('#surname').val(),
                                                                    $('#login').val(),
                                                                    $('#password').val(),
                                                                    $('#client').val(),
                                                                    $('#userlevel').val(),
                                                                    $('input:radio[name=user[active]]:checked').val())
                                                                    ">
    <table class="tableForm">
        <tr>
            <td>
                <label for="name">Name <span class="red">*</span> </label>
            </td>
            <td>
                <input name="user[name]" id="name" type="text" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="surname">Surname<span class="red">*</span> </label>
            </td>
            <td>
                <input name="user[surname]" id="surname" type="text" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="email">Email<span class="red"></span> </label>
            </td>
            <td>
                <input name="user[email]" id="email" type="text" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="telephone">Telephone<span class="red"></span> </label>
            </td>
            <td>
                <input name="user[telephone]" id="telephone" type="text" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="login">Login<span class="red">*</span> </label>
            </td>
            <td>
                <input name="user[login]" id="login" type="text" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="password">Password<span class="red">*</span> </label>
            </td>
            <td>
                <input name="user[password]" id="password" type="password" />&nbsp;<label class="hide" for="passwordShort">This password is short (min. 6 chars)!</label>
            </td>
        </tr>
        <tr>
            <td>
                <label for="client">Client<span class="red">*</span> </label>
            </td>
            <td>
                <input name="user[userlevel]" id="userlevel" value="1" type="hidden" />
                <select name="user[client]" size="1" id="client">
                    <option value="">Please select</option>
                    {foreach $data.clients as $key => $client}
                        <option {if $smarty.session.user.user_type_id!=$smarty.const.USER_TYPE_CLIENT && $client.bad_payer==1}class="badPayer"{/if} value="{$client.klient_id}">{$client.name}</option>
                    {/foreach}
                </select>
            </td>
        </tr>
        <tr id="associatedClientsForm">
            <td>
                <label for="associatedClients">Associated clients<span class="red"></span> </label>
            </td>
            <td>
                <select name="user[associatedClients][]" size="10" id="associatedClients" multiple="" style="width: 500px">
                    {foreach $data.clients as $key => $client}
                        <option value="{$client.klient_id}">{$client.name}</option>
                    {/foreach}
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label for="active">Active<span class="red">*</span> </label>
            </td>
            <td>
                <input name="user[active]" type="radio" value="1" checked="checked" /> Yes <br/>
                <input name="user[active]" type="radio" value="0" /> No
            </td>
        </tr>
        <tr>
            <td>
                <label for="active">Prefered to protocol<span class="red"></span> </label>
            </td>
            <td>
                <input name="user[prefered]" type="radio" value="1" /> Yes <br/>
                <input name="user[prefered]" type="radio" value="0" checked="checked" /> No
            </td>
        </tr>
        <tr>
            <td>
                <label for="notify">Send notify always if Responsible<span class="red"></span> </label>
            </td>
            <td>
                <input name="user[notify]" type="radio" value="1" id="notify" checked="checked"/> Yes <br/>
                <input name="user[notify]" type="radio" value="0" /> No
            </td>
        </tr>
        <tr class="submitRow">
            <td>
                <input name="action" value="add_user" type="hidden" />
            </td>
            <td>
                <input type="submit" value="Add user" name="add_user" /> &nbsp; 
                <span class="red">* Required</span>
            </td>
            <td></td>
        </tr>
    </table>
</form>